Methods

Following is a listing of methods used in customizing the DjVu Browser Plug-in along with their descriptions.

Name Description
SHORT view = NavView() Moves one step forward or backward in the “View Path” history (each time the user changes the page, zoom, rotation, scroll location). Valid values for nView are -1 and +1.
SaveAs(fname, doctype) Saves the file to disk. Fname is the filesystem path to the destination file. If doctype is “single” then only the current page is saved. If doctype is “indirect” or “bundled” then the whole document is saved.
CopySelectedText() Copies selected text to the clipboard.
SelectAllText() Selects all the text on the current page.
STRING SText = DjVuCtl1.SelectedText() Sets SText to selected text.
UnselectText() Unselects (and unhighlights) the selected text.
CopyImage() Copies the raster image of the current page to the clipboard.
ExportImageAs(fname,format)

Saves current page to the specified filename in the given format.

fname is a filesystem path to the destination file. 

format is ignored. “BMP” is currently the only format supported.

PrintDocTo(StartPage,EndPage,Zoom, Printername, options)

Prints a contiguous sequence of pages from the current document without prompting the user.

StartPage1-#of pages. First page to be printed. –1 prints the whole document.

EndPageStartPage-# of pages. Last page to be printed. Ignored if StartPage = -1.

Zoomcurrentzoom, originalsize or shrinktofit. If empty string (""), uses shrinktofit.

Printername – Name of a valid printer. If empty string (""), uses the default printer.

Options – Reserved. Pass empty string("").

ShowMagnifier (show)

Show. Bool.

Turns the Magnifier glass on or off.

ClearCache() Empties the decode cache without changing MaxCacheSize. Ignored if MaxCacheSize=0 or if Cache=No. (See "Setting Preferences".)
RestoreDefaults() Resets the properties exposed via the Preferences dialog to their original (default) settings. (See "Setting Preferences".)
HighlightTerm(exp, bMatchCase, bMatchWord, bAllMatches, color)

Highlights either the first or all occurrences of exp on the current page in the specified color.

exp – String Expression to be searched.

bMatchCase – If true, match is case-sensitive.

bMatchWord – If true, match is whole-word only.

bAllMatches – If true, all occurrences are highlighted.

color – RGB value giving the highlight color.

Examples:

(VB6 and Jscript)

myDjVu.HighlightTerm("DjVu", 0,0,1, 0x0000FF);

(VB.NET)

UInt32 convcolor = Convert.ToUInt32("0000ff", 16)

 

myDjVu.HighlightTerm(Term1, 0, 1, 1, convcolor)

AddHighlightRect(x0,y0,w,h,color)

Adds a highlight rectangle.

x0, y0 – Text. Pixel coordinates of the lower left corner of the highlight area. Referenced to lower left corner of image.

w, h – Text. Width and height in pixels.

color – RGB value.

RemoveAllHighlightRect()

Removes all highlighting created by AddHighlightRect()and HighlightTerm()

Does not affect highlight annotations that are part of the document.

STRING sErr = GetLastDjVuError () Sets sErr to the string corresponding to the last error generated by the control.
LONG nPages = GetDocPagesCount() Sets nPages to the number of pages in the document.
INTEGER nVer = GetDocFormatVersion() Sets nVer to the DjVu file format version.
INTEGER nDPI = GetPageResolution () Sets nDPI to the resolution of the current page, in dpi.
LONG nLength = GetPageLength () Sets nLength to the length of the current page, in pixels.
LONG nWidth = GetPageWidth () Sets nWidth to the width of the current page, in pixels.
STRING sType = GetDocType () Sets sType to “bundled”, “indirect” or “single”, the type of multipage DjVu document.
ScrollImage(x, y)

Scrolls image by (x, y) pixels in original image coordinates.

Right: x>0

Down: y>0

CmdHelp() Launches Help. Uses HelpURL property.
CmdPageInfo() Posts the Page Info dialog.
CmdDocInfo() Posts the Document Info dialog.
CmdSavePageAs() Posts the “Save Page As…” dialog.
CmdSaveDocAs() Posts the “Save Document As…” sequence of dialogs.
CmdFind() Posts the Find dialog.
CmdExportToFile() Posts the “Export To File” dialog.
CmdPrint() Posts the Print dialog.
CmdPreferences() Posts the Preferences dialog.
CmdAboutDjVu() Posts the About DjVu dialog.